import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ChatServer {
    public static void main(String[] args)  {
        try {
        ServerSocket server = new ServerSocket(9900);
        //监听
        while(true){
            //服务器端产生一个socket负责和客户端通信
            Socket socket=server.accept();
            //引入多线程接收socket对应的客户端的聊天信息，支持可以处理多个客户端(接收信息，转发)
            new Thread(new ChatChannel(socket)).start();
            }

            }catch (IOException e){
            e.printStackTrace();
        }
    }
}
